<template>
  <view class="wrapper">
    <view class="title time">今日-第{{ liveDay }}天 </view>
    <view class="basic">
      <view class="title" @click="ishowInfo = !ishowInfo"> 
        <view>基本信息<img :class="!ishowInfo ? 'rotate' : ''" src="https://szgd-dev.tgovcloud.com/public/images/arr-down.png" /></view>
      </view>
      <view class="listContainer" :class="{'ishowInfo': ishowInfo}">
        <view class="list">
          <view class="type">姓名</view>
          <view class="detail"> {{ checkInInfo.name }} </view>
        </view>

        <view class="list">
          <view class="type">证件类型</view>
          <view class="detail">
            <view>{{ cardTypeText }}</view>
            <!-- <template v-for="(item) in cardTypes">
              <view :key="item.value" v-if="item.value == checkInfo.cardType">{{
                item.label
              }}</view>
            </template> -->
          </view>
        </view>

        <view class="list">
          <view class="type">证件号码</view>
          <view class="detail"> {{ checkInInfo.cardId || "" }} </view>
        </view>

        <!-- <view class="list">
          <view class="type">电话号码</view>
          <view class="detail"> {{ userInfo.phone }} </view>
        </view> -->
        <view class="list">
          <view class="type">国籍</view>
          <view class="detail"> {{ checkInInfo.nationality || "" }} </view>
        </view>
        <view class="list" style="border: none">
          <view class="type">年龄</view>
          <view class="detail"> {{ checkInInfo.age || "" }}</view>
        </view>
      </view>
    </view>
    <view class="form-wrapper">
      <view class="title" @click="ishowReport = !ishowReport">
        <view>
          报告记录
          <img :class="!ishowReport ? 'rotate' : ''" src="https://szgd-dev.tgovcloud.com/public/images/arr-down.png" />
        </view>
      </view>

      <view class="form-content report-content" :class="{'ishowReport': ishowReport}">
        <view class="form-item-box">
          <view class="label">健康排查登记</view>
          <view class="item-detail" @click="toMedicalObservation">查看 ></view>
        </view>
        <view class="form-item-box">
          <view class="label">医学观察记录</view>
          <view class="item-detail" @click="toDailyReport()">查看 ></view>
        </view>
        <!-- <view class="form-item form-item-date-picker">
          <view class="label">观察时间<text>*</text></view>
          <picker
            mode="multiSelector"
            :value="dateTime"
            @change="observationDateChange"
            class="picker-control-con-picker-date"
            @columnchange="observationColumn"
            :range="dateTimeArray"
          >
            <view class="lableBox" style="display: inline-block">
              <view class="uni-input">{{
                formData.gcsj || "请选择观察时间"
              }}</view>
            </view>
          </picker>
        </view> -->
      </view>
    </view>
    <view class="title" style="display:flex;justify-content: space-between;margin-top:30rpx;">
      <view>观察时间</view>
      <view style="font-size:32rpx;">
        <picker
          mode="multiSelector"
          :value="dateTime"
          @change="observationDateChange"
          class="picker-control-con-picker-date"
          @columnchange="observationColumn"
          :range="dateTimeArray"
        >
          <view class="lableBox" style="display: inline-block">
            <view class="uni-input">{{
              formData.gcsj || "请选择观察时间"
            }}</view>
          </view>
        </picker>
      </view>
    </view>
    <view class="form-wrapper myform">
      <view class="title"> 日常监测</view>
      <view class="form-content">
        <!--  <view class="form-item">
          <view class="label">体温</view>
          <input class="input" placeholder="请输入数值" />
        </view>
        <view class="form-item">
          <view class="label">血糖</view>
          <input class="input" placeholder="请输入数值" />
        </view>
        <view class="form-item">
          <view class="label">医学建议</view>
          <input class="input" placeholder="请输入数值" />
        </view>
        <view class="form-item">
          <view class="label">症状</view>
          <input class="input" placeholder="请输入数值" />
        </view> -->
        <view class="form-item">
          <view class="label">体温<text>*</text></view>
          <uni-easyinput
            type="digit"
            v-model="formData.tw"
            placeholder="请输入体温"
            :class="{'risk-value':parseFloat(formData.tw)>=37.3}"
          ></uni-easyinput>
        </view>

        <view class="form-item form-item-symptoms form-item-border-none">
          <view class="label"> 十大症状</view>
          <view class="main-symptoms my-checkbox my-checkbox-style">
            <uni-data-checkbox
              multiple
              v-model="formHandle.mildSymptomIds"
              :localdata="mildSymptoms"
              class="my-raido"
              @change="onMildSymptomChange"
            ></uni-data-checkbox>
            <!-- <checkbox-group @change="onMildSymptomChange">
              <template v-for="(item, index) in mildSymptoms">
                <view class="checkbox" :key="index">
                  <checkbox
                    :value="item.value"
                    :checked="formHandle.mildSymptomIds.includes(item.value)"
                  ></checkbox>
                  <label>{{ item.text }}</label>
                </view>
              </template>
            </checkbox-group> -->
            <view
              class="other-symptoms"
              v-if="formHandle.mildSymptomIds.includes('11')"
            >
              <uni-data-checkbox
                multiple
                v-model="formHandle.severeSymptomIds"
                :localdata="severeSymptoms"
                class="my-raido"
              ></uni-data-checkbox>
              <view
                class="other-symptom-input"
                v-if="formHandle.severeSymptomIds.includes('11')"
              >
                <uni-easyinput
                  type="text"
                  v-model="formData.qtzz"
                  placeholder="请输入其它症状"
                ></uni-easyinput>
              </view>
              <!-- <checkbox-group @change="onSevereSymptomChange">
                <template
                  class="symptom"
                  v-for="(item, index) in severeSymptoms"
                >
                  <view class="checkbox" :key="index">
                    <checkbox
                      :value="item.value"
                      :checked="
                        formHandle.severeSymptomIds.includes(item.value)
                      "
                    ></checkbox>
                    <label>{{ item.label }}</label>
                  </view>
                </template>
              </checkbox-group> -->
            </view>
          </view>
        </view>
        <view class="form-item">
          <view class="label">心率（次/分）</view>
          <uni-easyinput
            type="number"
            v-model="formData.heartRate"
            placeholder="请输入心率"
          ></uni-easyinput>
        </view>
        <view class="form-item">
          <view class="label">血糖</view>
          <uni-easyinput
            type="digit"
            v-model="formData.xt"
            placeholder="请输入血糖"
          ></uni-easyinput>
        </view>
        <view class="form-item">
          <view class="label"> 血压(低)</view>
          <uni-easyinput
            type="digit"
            v-model="formData.xydy"
            placeholder="请输入血压"
          ></uni-easyinput>
        </view>
        <view class="form-item">
          <view class="label"> 血压(高)</view>
          <uni-easyinput
            type="digit"
            v-model="formData.xygy"
            placeholder="请输入血压"
          ></uni-easyinput>
        </view>

        <view>
          <view
            class="form-item inline-item form-item-border-none form-item-radio"
          >
            <view class="label">1.有核酸检测</view>
            <uni-data-checkbox
              v-model="formHandle.hsjg"
              :localdata="results"
              class="my-raido"
              @change="onCheckRadioChange"
            ></uni-data-checkbox>
            <!-- <radio-group @change="onCheckRadioChange">
              <label>
                <radio :checked="formData.hsjg === '0'" value="0">否</radio>
              </label>
              <label>
                <radio :checked="formData.hsjg === '1'" value="1">是</radio>
              </label>
            </radio-group> -->
          </view>
          <view v-if="formData.hsjg === '1'">
            <view class="form-item" style="display:flex;">
              <view class="label" style="padding-right:20rpx;white-space:nowrap;">采样方式<text>*</text></view>
              <uni-data-checkbox 
                multiple 
                v-model="checkBoxValue" 
                :localdata="checkWays" 
                :map="checkWaysMap"
                @change="checkBoxChange($event)"
                ></uni-data-checkbox>
              <!-- <view class="label">采样方式<text>*</text></view> -->

              <!-- <view class="picker">
                <picker
                  :value="formHandle.cyfsIndex"
                  :range="checkWays"
                  range-key="label"
                  @change="onCheckPickerChange"
                >
                  <view class="inline-between">
                    <view class="picker-text">{{
                      checkWays[formHandle.cyfsIndex].label || "请选择采样方式"
                    }}</view>
                    <view class="right-arrow-icon">
                      <image
                        class="nav-list-item-arr-show"
                        src="https://szgd-dev.tgovcloud.com/public/images/arr-right.png"
                        mode="widthFix"
                      ></image>
                    </view>
                  </view>
                </picker>
              </view> -->
            </view>

            <view class="form-item form-item-date-picker" style="display:flex;">
              <view class="label" style="padding-right:20rpx;white-space:nowrap;">采样时间<text>*</text></view>
              <picker
                mode="multiSelector"
                :value="samplingTime"
                @change="samplingDateChange"
                class="picker-control-con-picker-date"
                @columnchange="samplingColumn"
                :range="samplingTimeArray"
              >
                <view class="lableBox" style="display: inline-block">
                  <view class="uni-input">{{
                    formData.cysj || "请选择采样时间"
                  }}</view>
                </view>
              </picker>
            </view>

          </view>
        </view>
        <view>
          <view
            class="form-item inline-item form-item-border-none form-item-radio"
          >
            <view class="label">2.有中药治疗</view>
            <uni-data-checkbox
              v-model="formHandle.zyzl"
              :localdata="results"
              class="my-raido"
              @change="onTreatmentRadioChange"
            ></uni-data-checkbox>
            <!-- <radio-group @change="onTreatmentRadioChange">
              <label>
                <radio :checked="formData.zyzl === '0'" value="0">否</radio>
              </label>
              <label>
                <radio :checked="formData.zyzl === '1'" value="1">是</radio>
              </label>
            </radio-group> -->
          </view>

          <view class="form-item form-item-textarea form-item-border-none">
            <view class="label">医学建议</view>

            <textarea maxlength='400' placeholder="请输入不超400字的医学建议" v-model="formData.yxjy" />
          </view>

          <view class="form-item form-item-textarea form-item-border-none">
            <view class="label">巡诊意见</view>

            <textarea maxlength='400' placeholder="请输入不超400字的巡诊意见" v-model="formData.xzyj" />
          </view>
          <view class="form-item form-item-textarea form-item-border-none">
            <view class="label">备注</view>

            <textarea maxlength='400' placeholder="请输入不超400字的备注" v-model="formData.bz" />
          </view>
          <view class='placeholder'></view>
        </view>
        <!-- <view class="picker-time">
        <picker
          class="picker-btn"
          mode="date"
          :value="date"
          :start="startDate"
          :end="endDate"
          @change="bindDateChange"
        >
          <view class="uni-input">{{ date }}</view>
        </picker>
        <div class="kailong"></div> -->
        <!-- </view> -->
        <!-- <uni-forms-item name="bloodSugar" label="血糖">
            <uni-easyinput
              type="text"
              v-model="formData.bloodSugar"
              placeholder="请输入血糖"
            ></uni-easyinput>
          </uni-forms-item>
          <uni-forms-item name="bloodSugar" label="血压" class="bloodSugar">
            <uni-easyinput
              type="text"
              v-model="formData.sbp"
              placeholder="请输入高压"
            ></uni-easyinput>
            <view class="split">/</view>
            <uni-easyinput
              type="text"
              v-model="formData.dbp"
              placeholder="请输入低压"
            ></uni-easyinput>
          </uni-forms-item>
          <uni-forms-item name="observedTime" label="观察时间">
            <uni-easyinput
              v-model="formData.observedTime"
              placeholder="请输入观察时间"
            ></uni-easyinput>
          </uni-forms-item>
          <checkbox-group @change="samplingChange">
            <label>
              <checkbox
                class="checkbox"
                value="1"
                :checked="formData.nucleicAcidSampling == '1'"
                >核酸采样</checkbox
              >
            </label>
          </checkbox-group>
          <picker
            v-if="formData.nucleicAcidSampling == '1'"
            v-model="formData.samplingMethod"
            :range="rangeType"
            @change="pickChange"
          >
            <view
              :class="formData.samplingMethod == -1 ? 'mypickerNO' : 'mypicker'"
              >{{
                rangeType[formData.samplingMethod]
                  ? rangeType[formData.samplingMethod]
                  : "请选择采样类型"
              }}</view
            >
          </picker>
          <view class="block_line"></view>
          <checkbox-group @change="chineseChange">
            <label>
              <checkbox
                value="1"
                :checked="formData.usingtradChineseMed == '1'"
                class="checkbox"
                >中药治疗</checkbox
              >
            </label>
          </checkbox-group>
          <view class="block_line"></view>

          <uni-forms-item name="medicalAdvice" label="医学建议">
            <uni-easyinput
              v-model="formData.medicalAdvice"
              placeholder="请输入医学建议"
            ></uni-easyinput>
          </uni-forms-item> -->
      </view>
      <view class="example">
        <button class="submit" @click="submitForm('form')">{{isChange == '1' ? '确认修改' : '提交'}}</button>
      </view>
    </view>
  </view>
</template>

<script>
import { cardTypes, mildSymptoms, severeSymptoms } from "@/data";
import { updateMedicalObservation, getUserInfoByCardId, getMedicalObservation } from "@/api";
const {
  dateTimePicker,
  getMonthDay,
  generateTimeStr,
} = require("@/utils/dateTimePicker.js");
import dayjs from "dayjs";
export default {
  data() {
    return {
      dateTimeArray: null,     // 观察时间数组
      dateTime:[],             // 观察时间
      samplingTimeArray:null,  // 采样时间日期插件数据
      samplingTime: [],        // 采样时间
      cardTypeText: "",
      userInfo: {}, //用户信息
      checkInInfo: {}, // 隔离信息
      liveDay: 1, // 隔离天数
      isChange: '0',
      formHandle: {
        cyfsIndex: "",
        mildSymptomIds: [],
        mildSymptomIdsCache: [],
        severeSymptomIds: [],
        severeSymptomIdsCache: [],

        hscy: "", // 核酸采样
      },
      checkBoxValue:[],
      formData: {
        bz: "",
        cyfs: "", // 采样方式
        cysj: "", //
        deptCascadeCode: "",
        deptName: "",
        divisionCode: "",
        divisionName: "",
        ejzz: "",
        gcsj: "", // 观察时间
        gllx: "",
        hsjg: "", //有无采样
        isolateId: "", // 隔离 id
        jcsj: "",
        qtzz: "", // 其它症状
        tw: "", // 体温
        heartRate: "", // 心率
        xt: "", // 血糖
        xydy: "", // 血压（低）
        xygy: "", // 血压（高）
        yjzz: "",
        yxjy: "", // 医学建议
        zyzl: "", // 中医治疗
        xzyj: "", // 巡诊意见
        bz: "", //备注 
      },
      mildSymptoms, // 轻症状
      severeSymptoms, // 重症
      checkWays:[], //核酸检测方式
      checkWaysMap:{text:'label',value:'value'},
      cardTypes,
      results: [
        {
          text: "否",
          value: "0",
        },
        {
          text: "是",
          value: "1",
        },
      ],
      ishowInfo: false,
      ishowReport: false,
    };
  },
  async onLoad(e) {
    console.log('onLoad', e);
    this.checkWays = await this.$store.dispatch('getDic','sample_mode');
    this.isChange = e.isChange;
    if (this.isChange == '1') {
      this.resetDataInfo();
    }
    this.initTime();

    this.initUserInfo();
    this.initSetCurrentTime();
  },
  methods: {
    resetDataInfo() {
      const checkInInfo = uni.getStorageSync("personInfo");
      getMedicalObservation({personId: checkInInfo.personId}).then((res) => {
        console.log('resetDataInfo', res);
        if (res && res.length > 0) {
          const resData = res[0];
          let formData = this.formData;
          for (let key in formData) {
            if (key != 'gcsj') {
              formData[key] = resData[key];
            }
          }

          if (resData.ejzz) {
            resData.yjzz += ',11';
          }
          if (formData.qtzz) {
            resData.ejzz += ',11';
          }
          console.log('resetDataInfo_1', formData);
          formData.healthId = checkInInfo.healthId;
          this.formData = formData;
          this.checkBoxValue = resData.cyfs.split(',');
          this.formHandle = {
            cyfsIndex: resData.cyfs,
            mildSymptomIds: resData.yjzz.split(','),
            mildSymptomIdsCache: resData.yjzz.split(','),
            severeSymptomIds: resData.ejzz.split(','),
            severeSymptomIdsCache: resData.ejzz.split(','),
            hsjg: resData.hsjg,
            zyzl: resData.zyzl
          };
        }
      })
    },
    initUserInfo() {
      const checkInInfo = uni.getStorageSync("personInfo")
      console.log('checkInInfo,', checkInInfo)
      // this.userInfo = checkInInfo;
      this.checkInInfo = checkInInfo;
      this.getLiveDay(checkInInfo.moveStartTime);

      this.formData.personId = checkInInfo.personId;
      this.formData.isolateId = checkInInfo.isolateId;

      // 证件类型
      cardTypes.forEach((item) => {
        if (item.value == checkInInfo.cardType) {
          this.cardTypeText = item.label;
        }
      });
      // getUserInfoByCardId({ cardId: userInfo.id_code }).then((res) => {
      //   if (res.length == 0) {
      //     uni.showToast({
      //       title: "该用户未入住",
      //       icon: "none",
      //       duration: 3000,
      //     });
      //     setTimeout(function () {
      //       uni.switchTab({
      //         url: `../index/index`,
      //       });
      //     }, 2000);
      //     return;
      //   }

      //   if (!checkInInfo.isolateId) {
      //     uni.showToast({
      //       title: "该用户尚未做健康登记",
      //       icon: "none",
      //       duration: 3000,
      //     });
      //     setTimeout(function () {
      //       uni.switchTab({
      //         url: `../index/index`,
      //       });
      //     }, 2000);
      //     return;
      //   }

      // this.checkInInfo = checkInInfo;

      // this.formData.personId = checkInInfo.personId;
      // this.formData.isolateId = checkInInfo.isolateId;

      //  // 证件类型
      // cardTypes.forEach((item) => {
      //   if (item.value == checkInInfo.cardType) {
      //     this.cardTypeText = item.label;
      //   }
      // });
      // });
    },
    // 计算已隔离天数
    getLiveDay(startTime) {
      if(!startTime || JSON.stringify(startTime)==='{}') return;
      // console.log('startTime.split=====', startTime);
      const startTimestamp = new Date(startTime.split(" ")[0]).getTime();
      const nowTimestamp = new Date().getTime();
      const diffDay = (nowTimestamp - startTimestamp) / (60 * 60 * 24 * 1000);
      this.liveDay = diffDay < 1 ? 1 : Math.ceil(diffDay);
    },
    // 返回修改回显
    getMedicalObservation(personId) {
      getMedicalObservation({ personId: personId }).then((res) => {
        this.formInfo = res[0];
      });
    },

    // 选择症状(轻)
    onMildSymptomChange(item) {
      const values = item.detail.value;
      const firstValue = values[0];
      const oldValues = this.formHandle.mildSymptomIdsCache;
      const oldFirstValue = oldValues[0];
      // 无
      if (firstValue == "0") {
        this.formHandle.mildSymptomIds = ["0"];
        this.formHandle.severeSymptomIds = [];
        this.formData.qtzz = '';
      }
      if (oldFirstValue == "0" && values.length > 0) {
        this.formHandle.mildSymptomIds = values.filter((value) => value != 0);
      }
      if (!values.includes("11")) {
        this.formHandle.severeSymptomIds = [];
      }
      this.formHandle.mildSymptomIdsCache = this.formHandle.mildSymptomIds;
    },
    // // 选择症状(重)
    // onSevereSymptomChange(item) {
    //   const values = item.detail.value;

    //   this.formHandle.severeSymptomIds = values;
    // },

    // 有无核酸检测
    onCheckRadioChange(e) {
      const value = e.detail.value;
      this.formData.hsjg = value;
      if (value == "0") {
        this.formData.cyfs = "";
        this.formHandle.cyfsIndex = "";
      }
    },
    // 核酸采样方式
    onCheckPickerChange(e) {
      const index = e.detail.value;
      this.formHandle.cyfsIndex = index;

      this.formData.cyfs = this.checkWays[index].value;
    },
    checkBoxChange(e){
      let data = e.detail.data;
      let cyfs = data.map(item=>{
        return item.value
      }).join(',')
      this.formData.cyfs = cyfs;
    },
    // 有无中医治疗
    onTreatmentRadioChange(e) {
      const value = e.detail.value;
      this.formData.zyzl = value;
    },

    // // 初始化观察时间
    // initDate() {
    //   this.formData.gcsj = dayjs().format("YYYY-MM-DD HH:mm:ss");
    // },
    // // 观察时间
    // bindDateChange: function (e) {
    //   this.formData.gcsj = `${e.target.value} 00:00:00`;
    // },

    /**
     * 手动提交
     * @param {Object} form
     */
    submitForm(form) {
      // 过滤其它
      this.formData.yjzz = this.formHandle.mildSymptomIds.filter(
        (value) => value != "11"
      );
      this.formData.ejzz = this.formHandle.severeSymptomIds.filter(
        (value) => value != "11"
      );
      const { tw, hsjg, cyfs, heartRate, xt, xydy, xygy, gcsj, cysj } = this.formData;
      let tips = "";
      if (!tw) {
        tips = "请输入体温";
      } else if (!gcsj) {
        tips = "请选择观察时间";
      } else if (hsjg == "1" && cyfs == "") {
        tips = "请选择核酸采样方式";
      } else if (hsjg == "1" && cysj == "") {
        tips = "请选择采样时间";
      }

      if (hsjg === "0" ) {
        this.formData.cysj = '';
      }

      if (tw) {
        if (parseFloat(tw) > 45 || parseFloat(tw) < 35) {
          tips = "请输入正确的体温";
        }
      }

      if (heartRate) {
        if (heartRate.indexOf('.') != -1) {
          tips = "请输入正确的心率";
        }
      }

      if (xt) {
        if (parseFloat(xt) > 35 || parseFloat(xt) < 1) {
          tips = "请输入正确的血糖";
        }
      }

      if (xygy) {
        if (parseFloat(xygy) > 220 || parseFloat(xygy) < 60) {
          tips = "请输入正确的血压";
        }
      }

      if (xydy) {
        if (parseFloat(xydy) > 220 || parseFloat(xydy) < 60) {
          tips = "请输入正确的血压";
        }
      }
      let { isolateId } = uni.getStorageSync("personInfo");
      if(!isolateId){
        tips = "该隔离人员尚未做健康排查";
      }
      if (tips) {
        uni.showToast({
          title: tips,
          icon: "none",
        });
      } else {
        // uni.setStorage({ key: "checkInInfo", data: this.checkInInfo });
        uni
          .setStorage({ key: "observedInfo", data: this.formData })
          .then(() => {
            uni.navigateTo({
              url: `../medicalObservation/confirm?day=${this.liveDay}&isChange=${this.isChange}`,
            });
          });
      }
    },

    initTime() {
      let date = new Date();
      let endYear = date.getFullYear();
      // 获取完整的年月日 时分秒，以及默认显示的数组
      let obj = dateTimePicker(this.startYear, endYear);

      obj.dateTimeArray[0] = [new Date().getFullYear()];

      // 精确到分的处理，将数组的秒去掉
      // let lastArray = obj.dateTimeArray.pop();
      // let lastTime = obj.dateTime.pop();

      this.dateTimeArray = obj.dateTimeArray;
      this.dateTime = obj.dateTime;

      // 采样时间
      this.samplingTimeArray = obj.dateTimeArray;
      this.samplingTime = obj.dateTime;
    },
    // 初始化观察时间
    initSetCurrentTime(){
      const dateStr = dayjs().format('YYYY-MM-DD HH:mm:ss')
      this.formData.gcsj = dateStr;
      this.formData.cysj = dateStr;
      // console.log(dateStr)
    },
    // bindDateChange(e) {
    //   this.dateTime = e.detail.value;
    //   let timer = generateTimeStr(this.dateTimeArray, this.dateTime);
    //   let thisTimer = dayjs().format('YYYY-MM-DD HH:mm:ss')
    //   this.formData.gcsj = this.compareTime(timer,thisTimer)
    //   //ios时间不能用'-'解析成时间戳
    // },
    compareTime(timer,thisTime){
      var _timer = timer.replace(/-/g,'/');
      var _thisTime = thisTime.replace(/-/g,'/');
      var date1 =  new Date(_timer);
      var date2 = new Date(_thisTime);
      if(date1>date2){
        return thisTime
      }
      return timer;
    },

    // 修改时间
    bindDateChange(e, time, timeArr, targetType) {
      time = e.detail.value;
      let timer = generateTimeStr(timeArr, time);
      let thisTimer = dayjs().format('YYYY-MM-DD HH:mm:ss')
      let targetTime = this.compareTime(timer,thisTimer)
      if (targetType ==1) {
        this.formData.gcsj = targetTime
      }else{
        this.formData.cysj = targetTime
      }
    },
    // 观察时间修改
    observationDateChange(e){
      this.bindDateChange(e, this.dateTime, this.dateTimeArray, 1);
    },

    // 采样时间修改
    samplingDateChange(e){
      this.bindDateChange(e, this.samplingTime, this.samplingTimeArray, 2);
    },

    // /*年,月切换时重新更新计算*/
    // changeDateTimeColumn(e) {
    //   //let {id} = e.target;
    //   let { column, value } = e.detail;
    //   if (column == 0 || column == 1) {
    //     //直接修改数组下标视图不更新,用深拷贝之后替换数组
    //     let dateTime = JSON.parse(JSON.stringify(this.dateTime));
    //     let dateTimeArray = JSON.parse(JSON.stringify(this.dateTimeArray));
    //     dateTime[column] = value;
    //     dateTimeArray[2] = getMonthDay(
    //       dateTimeArray[0][dateTime[0]],
    //       dateTimeArray[1][dateTime[1]]
    //     );
    //     this.dateTime = dateTime;
    //     this.dateTimeArray = dateTimeArray;
    //   }
    // },

    /*年,月切换时重新更新计算*/
    changeDateTimeColumn(e, time, timeArr) {
      //let {id} = e.target;
      let { column, value } = e.detail;
      if (column == 0 || column == 1) {
        //直接修改数组下标视图不更新,用深拷贝之后替换数组
        let dateTime = JSON.parse(JSON.stringify(time));
        let dateTimeArray = JSON.parse(JSON.stringify(timeArr));
        dateTime[column] = value;
        dateTimeArray[2] = getMonthDay(
          dateTimeArray[0][dateTime[0]],
          dateTimeArray[1][dateTime[1]]
        );
        time = dateTime;
        timeArr = dateTimeArray;
      }
    },
    
    // 观察时间重计算
    observationColumn(e){
      this.changeDateTimeColumn(e, this.dateTime, this.dateTimeArray);
    },

    // 采样时间重计算
    samplingColumn(e){
      this.changeDateTimeColumn(e, this.samplingTime, this.samplingTimeArray);
    },

    toDailyReport() {
      // if (!this.checkInInfo.isolateId) {
      //   uni.showToast({
      //     title: "该用户尚未做健康排查",
      //     icon: "none",
      //     duration: 3000,
      //   });
      //   return
      // }
      uni.navigateTo({
        url:'../medicalObservation/dailyReport?isolateId='+this.checkInInfo.isolateId
      })
    },
    toMedicalObservation() {
      uni.navigateTo({
        url:`/pages/healthInspect/investigateDetails?canEdit=1&from=medicalObservation&isChange=${this.isChange}`
      })
    },
  },
};
</script>

<style lang="scss">
.wrapper {
  box-sizing: border-box;
  // padding-bottom: 120rpx;
  background-color: #f9f9f9;
  .example {
    position: fixed;
    width: 100%;
    left: 0;
    bottom: 0;
    padding-bottom: 30rpx;
    background-color: #f9f9f9;
    z-index: 10;
  }
  .title {
    height: 98rpx;
    line-height: 98rpx;
    font-size: 40rpx;
    padding: 0 32rpx;
    background-color: #fff;
    border-bottom: 1rpx solid #e5e5e5;
    position: relative;
    img {
      width: 26rpx;
      height: 15rpx;
      position: absolute;
      right: 38rpx;
      top: 50%;
      transform: translateY(-50%);
      transition: all 0.5s;

      &.rotate {
        transform: rotate(-90deg);
        transition: all 0.5s;
      }
    }
  }
  .time {
    color: #2c9af1;
    border-bottom: none;
    background-color: #fff;
  }
}
// 基本信息
.basic {
  background-color: #fff;

  .listContainer {
    padding: 0 32rpx;
    height: 0;
    overflow: hidden;
    transition: height 0.15s;
    -moz-transition: height 0.15s; /* Firefox 4 */
    -webkit-transition: height 0.15s; /* Safari 和 Chrome */
    -o-transition: height 0.15s; /* Opera */
  }
  .ishowInfo{
    height: 399rpx;
  }
  .list {
    // height: 140rpx;
    height: 74rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 0.5px solid #e5e5e5;
  }
  .type {
    font-size: 30rpx;
    font-family: PingFang SC;
    color: #999999;
    opacity: 1;
  }
  .detail {
    font-size: 34rpx;
    font-family: PingFang SC;
    color: #666666;
    opacity: 1;
  }
}
.placeholder{
  height:80rpx;
}
// 表单
.form-wrapper {
  margin-top: 30rpx;
  text {
    color: red;
  }
  .form-content {
    padding: 0 32rpx;
    background-color: #fff;
    .form-item-box{
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 30rpx;
        color: #999999;
        padding: 48rpx 0;
        border-bottom: 1rpx solid #E5E5E5;
        .item-detail{
          font-size: 34rpx;
          color: #2C9AF1;
        }
      }
  }
  .report-content{
    height: 0;
    overflow: hidden;
    transition: height 0.15s;
    -moz-transition: height 0.15s; /* Firefox 4 */
    -webkit-transition: height 0.15s; /* Safari 和 Chrome */
    -o-transition: height 0.15s; /* Opera */
  }
  .ishowReport{
    height: 285rpx;
  }
  .form-item-border-none {
    border-bottom: none !important;
  }
  .inline-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .risk-value{
    input{
      color: red!important;
    }
  }
  .other-symptom-input {
    border-bottom: 1rpx solid #e4e4e4;
  }
  .form-item-radio {
    label {
      margin-left: 60rpx;
    }
    .uni-data-checklist .checklist-group .checklist-box {
      margin-right: 0 !important;
      margin-left: 60rpx !important;
    }
  }

  .form-item-symptoms {
    .label {
      margin-bottom: 24rpx;
    }
    .checkbox {
      float: left;
      margin-bottom: 30rpx;
      margin-right: 30rpx;
      .label {
        font-weight: bold;
      }
    }
  }

  .main-symptoms {
    display: flex;
    flex-wrap: wrap;
    overflow: hidden;
  }
  .my-checkbox{
    padding:22rpx;
    .uni-data-checklist .checklist-group {
        justify-content: space-between;
    }
  }
  .submit {
    // margin-top: 30rpx;

    height: 94rpx;
    line-height: 94rpx;
    background: #2c9af1;
    opacity: 1;
    border-radius: 16rpx;
  }
  .form-item {
    padding-top: 20rpx;
    padding-bottom: 14rpx;
    color: #333333;
    font-size: 26rpx;
    border-bottom: 1rpx solid #e4e4e4;
    .label {
      color: #333333;
      font-size: 26rpx;
      font-weight: bold;
    }
    .checklist-text {
      color: #2c9af1;
      font-size: 30rpx !important;
      font-weight: bold;
    }
  }
  .form-item-textarea {
    .label {
      padding-bottom: 20rpx !important;
    }
    textarea {
      max-height: 200rpx;
    }
  }

  .form-item-select-picker {
    border-bottom: none;
    .picker {
      position: relative;
      display: flex;
      align-items: center;
      height: 77rpx;
      padding: 0 40rpx;
      background: #ffffff;
      box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.16);
      border-radius: 6rpx;
      picker {
        width: 100%;
      }
    }
    .right-arrow-icon {
      display: flex;
      align-items: center;
      position: absolute;
      top: 0;
      bottom: 0;
      right: 50rpx;
      transform: rotate(90deg);
      image {
        width: 20rpx;
      }
    }
  }
  .form-item-date-picker,
  .form-item-textarea,
  .form-item-select-picker {
    padding-bottom: 36rpx;
    .label {
      padding-bottom: 10rpx;
    }
  }

  .inline-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  // .picker-time {
  //   display: flex;
  //   align-items: center;
  //   height: 77rpx;
  //   margin: 36rpx 0;
  //   padding-left: 40rpx;
  //   background: #ffffff;
  //   box-shadow: 0px 0px 8rpx rgba(0, 0, 0, 0.16);
  //   opacity: 1;
  //   border-radius: 6rpx;
  // }
}

// .checkRoorm {
//   pointer-event: none;
//   .img {
//     pointer-event: auto;
//   }
//   p {
//     font-size: 34rpx;
//     line-height: 60rpx;
//     color: #000000;
//     &.noValue {
//       color: #ccc;
//     }
//   }
//   .picker-text {
//     font-size: 34rpx;
//   }
// }
// .medical {
//   width: 100%;
//   height: 100%;
//   background: #f9f9f9;
// }
// .time {
//   height: 98rpx;
//   line-height: 98rpx;
//   font-weight: 600;
//   color: #2c9af1;
//   position: relative;
//   background: #fff;
// }
// .time .today {
//   font-size: 40rpx;
//   margin-left: 32rpx;
// }
// .time .picker-time {
//   height: 98rpx;
//   line-height: 98rpx;
//   position: absolute;
//   right: 32rpx;
//   top: 0;
// }
// .time .picker-time .picker-btn {
//   margin-right: 40rpx;
//   font-size: 30rpx;
// }
// .time .kailong {
//   width: 0;
//   height: 0;
//   border-right: 14rpx solid transparent;
//   border-left: 14rpx solid transparent;
//   border-top: 14rpx solid #2c9af1;
//   position: absolute;
//   right: 0;
//   top: 50%;
//   transform: translateY(-50%);
// }
// .monitoring-item-hesuan {
//   height: 170rpx;
//   line-height: 170rpx;
//   position: relative;
// }
// .monitoring-item-hesuan .radio-item {
//   /* height: 170rpx;
//   line-height: 170rpx; */
//   position: absolute;
//   right: 0;
//   top: 50%;
//   transform: translateY(-50%);
// }
// .block_line {
//   width: 100%;
//   border-bottom: 1rpx solid #e5e5e5;
//   margin: 44rpx 0 34rpx;
// }
// .checkbox {
//   color: #666666 !important;
//   font-size: 30rpx !important;
// }
// .mypickerNO {
//   color: #666;
//   margin-top: 20rpx;
//   font-size: 34rpx;
// }
// .mypicker {
//   margin-top: 20rpx;
//   font-size: 34rpx;
// }
// .bloodSugar {
//   .uni-forms-item__content {
//     display: flex;
//   }
// }
// .split {
//   line-height: 70rpx;
// }
</style>
